<?php

namespace App\Http\Controllers;

use App\Services\BannerService;
use Illuminate\Http\Request;

class BannerController extends BaseController {

    public function index(Request $request) {
        $this->view_data['info'] = (new BannerService())->list();
        return view('banner.add', $this->view_data);
    }

    public function save(Request $request) {
        $images = $request->post("images");
        if (empty($images)){
            return $this->apiError('请上传图片');
        }

        (new BannerService())->save($images);
        return $this->apiSuccess('添加成功');

    }
}